<template>
	<view class="advertising">
		<swiper autoplay class="swiper">
			<swiper-item v-for="(item,index) in list" :key="index">
				<image :src="item.image" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		<view class="down" @click="skip">跳过 0{{ second }}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				time:null,
				second:3
			};
		},
		onLoad() {
			this.getadvertising()
		},
		methods:{
			//跳过
			skip () {
				clearInterval(this.time)
				uni.switchTab({url:'/pages/tabbar/home'})
			},
			getadvertising () {
				this.$http.get(this.$api.autarky_qdt).then(res=>{
					this.list = res.data
					this.time = setInterval(()=>{
						this.second--
						if (this.second <= 0) {
							clearInterval(this.time)
							uni.switchTab({url:'/pages/tabbar/home'})
						}
					},1000)
				})
			}
		}
	}
</script>

<style lang="scss">
.advertising {
	position: relative;
	height: 100vh;
	.swiper {
		width: 100%;
		height: 100%;
		position: absolute;
		image {
			width: 100%;
			height: 100%;
			display: block;
		}
	}
	.down {
		top: 80rpx;
		right: 30rpx;
		width: 130rpx;
		height: 50rpx;
		color: #FFFFFF;
		font-size: 26rpx;
		line-height: 50rpx;
		text-align: center;
		background: #999999;
		border-radius: 25rpx;
		position: absolute;
	}
}
</style>
